package com.hpsk.webSocket.utils;

import jakarta.annotation.Resource;
import lombok.Setter;
import org.springframework.ai.chat.ChatClient;
import org.springframework.ai.chat.ChatResponse;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.ai.ollama.OllamaChatClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Flux;

@Component
public class AiUtil {

    @Resource
    @Qualifier("ollamaChatClient")
    private OllamaChatClient ollamaChatClient;

    @Setter(onMethod_ = @Autowired)
    private ChatClient deepSeekClient;

    public String send(String receiveMessage){
        Prompt prompt = new Prompt(receiveMessage);
        String call = deepSeekClient.call(receiveMessage);
        return call;
//        ChatResponse chatResponse = ollamaChatClient.call(prompt);
//        return chatResponse.getResult().getOutput().getContent();
//        Flux<ChatCompletionResponse> chatCompletionResponseFlux = deepSeekClient.chatFluxCompletion(receiveMessage);
//        chatCompletionResponseFlux.next().block();
//        return "";
    }
}
